﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ScheduleMVVM.Model.PersistentFramework
{
    internal static class AssemblyInfoHelper
    {
        /// <summary>
        /// Returns app version in "MajorVer.MinorVer" format
        /// </summary>
        public static String VersionString
        {
            get
            {
                var version = GetCurrentVersion();
                return version.Major.ToString() + "." + version.Minor.ToString();
            }
        }
        /// <summary>
        /// Returns app build string in "Build.Revision" format
        /// </summary>
        public static String BuildString
        {
            get
            {
                var version = GetCurrentVersion();
                return version.Build.ToString() + "." + version.Revision.ToString();
            }
        }
        /// <summary>
        /// Retrieve the current version of the executing assembly.
        /// This is the one in the AssemblyVersion attribute.
        /// </summary>
        /// <returns></returns>
        public static Version GetCurrentVersion()
        {
            Version version;

            var assembly = System.Reflection.Assembly.GetExecutingAssembly().FullName;
            var fullVersionNumber = assembly.Split('=')[1].Split(',')[0];

            version = new Version(fullVersionNumber);

            return version;
        }
    }
}
